import { http } from './service.js'

//考勤列表 /pad/checkReport/check_record
export const getCheckRecord = () => {
	return http.request({
		url: 'pad/checkReport/check_record',
		method: 'POST',
	})
}
//批量签到
export const mulitCheckIn = (childrenIds) => {
	return http.request({
		url: 'pad/checkReport/mulit_check_in',
		method: 'POST',
		params: {
			'childrenIds': childrenIds
		}
	})
}
// 厦门园 批量签到
export const mulitCheckInV2 = (childrenIds) => {
	return http.request({
		url: 'pad/checkReport/mulit_check_inV2',
		method: 'POST',
		params: {
			'childrenIds': childrenIds
		}
	})
}

//批量签退
export const mulitCheckOut = (childrenIds) => {
	return http.request({
		url: 'pad/checkReport/mulit_check_out',
		method: 'POST',
		params: {
			'childrenIds': childrenIds
		}
	})
}

//签到
export const childrenCheckIn = (formData) => {
	return http.request({
		url: 'pad/checkReport/check_in',
		method: 'POST',
		params: formData
	})
}

export const childrenCheckInByFile = (formData, file) => {
	console.log(file)
	return http.upload('pad/checkReport/check_in', {
		formData: formData,
		filePath: file.uri,
		name: 'file'
	})
}

export const childrenCheckOut = (formData) => {
	return http.request({
		url: 'pad/checkReport/check_out',
		method: 'POST',
		params: formData
	})
}

export const childrenCheckOutByFile = (formData, file) => {
	return http.upload('pad/checkReport/check_out', {
		formData: formData,
		filePath: file.uri,
		name: 'file'
	})
}
// 详细晨检
export const addCheckReport = (params) => {
	return http.request({
		url: 'pad/checkReport/addCheckReport',
		method: 'POST',
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		},
		data: params
	})
}
export const getCheckReportInfo = (childId) => {
	return http.request({
		url: 'pad/checkReport/getCheckReportInfo',
		method: 'POST',
		params: {
			'childId': childId,
		}
	})
}

export const childrenCheckInV2 = (formData) => {
	return http.request({
		url: 'pad/checkReport/check_in_v2',
		method: 'POST',
		params: formData
	})
}

export const childrenCheckInV2ByFile = (formData, file) => {
	return http.upload('pad/checkReport/check_in_v2', {
		formData: formData,
		filePath: file.uri,
		name: 'file'
	})
}
export const getStaffCheck = (params) => {
	return http.request({
		url: '/v2/report/staff_checkin/staffCheckList',
		method: 'GET',
		params
	})
}

export const getStaffCheckList = (params) => {
	return http.request({
		url: '/v2/report/staff_checkin/list',
		method: 'GET',
		params
	})
}

export const getMonthRecordByTch = (params) => {
	return http.request({
		url: '/v2/report/staff_checkin/monthRecords',
		method: 'GET',
		params
	})
}
export const getDailyRecordByTch = (params) => {
	return http.request({
		url: '/v2/report/staff_checkin/dailyRecords',
		method: 'GET',
		params
	})
}


//家长端 宝宝考勤月查询
export const getMonthRecords = (month) => {
	return http.request({
		url: '/wx/api/checkin/monthRecords',
		method: 'GET',
		params: {
			'month': month
		}
	})
}
export const getDailyRecords = (day) => {
	return http.request({
		url: '/wx/api/checkin/dailyRecords',
		method: 'GET',
		params: {
			'day': day
		}
	})
}

//请假添加
export const addLeaveRecord = (params) => {
	return http.request({
		url: '/wx/api/leaveRecord/add',
		method: 'POST',
		params: params
	})
}
//请假查询
export const getLeaveRecord = (month) => {
	return http.request({
		url: '/wx/api/leaveRecord/list',
		method: 'GET',
		params: {
			'month': month,
			'pageNum': 0,
			'pageSize': 100,
		}
	})
}

